package org.jbrisk.exceptions;

public class EmptyStringArgumentException extends RuntimeException {

	private static final long serialVersionUID = 1L;

	private String argumentName;

	public String getArgumentName() {
		return argumentName;
	}

	public EmptyStringArgumentException(String argumentName) {
		
		super(getMessage(argumentName));

		this.argumentName = argumentName;
	}

	private static String getMessage(String argumentName) {

		if (argumentName == null)
			throw new IllegalArgumentException("The EmptyStringArgumentException constructor \"argumentName\" cannot be null!");
		
		if (argumentName.trim().length() == 0)
			throw new IllegalArgumentException("The EmptyStringArgumentException constructor \"argumentName\" cannot be an Empty (zero-length) String!");

		return "Argument \"" + argumentName + "\" cannot be an empty (zero-length) String!";
	}
}
